package com.dai.util;

import java.io.IOException;
import java.io.InputStream;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

public class sqlSessionUtil {
	@Test
	public  static  SqlSession getSqlSession(){
		SqlSession sq=null;
		InputStream res=null;
		try {
			 res = Resources.getResourceAsStream("sqlMapperConfig.xml");
			SqlSessionFactory build = new SqlSessionFactoryBuilder().build(res);
			sq = build.openSession();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return sq;
	}
}
